package com.yunji.common.enums.common;

import com.google.common.collect.Lists;

import java.util.List;
import java.util.Objects;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.user.enums
 * @Title: StaffNoticeTypes
 * @Description: : 消息类型
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-04-16 15:00:42      V1.0        HuaAo       新建类
 */

public enum NoticeTypes {

    CAPTURE_PRODUCT(0, "补货","补货成功提醒","{}商品,已补货完成,本次补货数量{}", Lists.newArrayList(UserType.STAFF.getCode())),
    SELL_PRODUCT(1, "售卖","货柜售卖提醒","{}号货柜，{}已售卖,请及时补货",Lists.newArrayList(UserType.STAFF.getCode())),
    CHANGE_PRICE(2, "改价","价格变动通知","名称为{}的商品,价格已经改动,请及时查看",Lists.newArrayList(UserType.PLATE.getCode()
            ,UserType.AGENT.getCode(),UserType.SITE.getCode())),
    STOCK_WARM(3, "预警","仓库预警","{}的{}商品库存已达预警值",Lists.newArrayList(UserType.PLATE.getCode()
            ,UserType.AGENT.getCode(),UserType.SITE.getCode())),
    ABNORMAL_DEVICE_WARM(4,"设备异常","设备异常提醒","{}名下货柜名称为{}的货柜检测到异常！故障原因:{},请及时处理,谢谢！",Lists.newArrayList(UserType.PLATE.getCode()
            ,UserType.AGENT.getCode(),UserType.SITE.getCode())),
    NO_CARGO(5,"无货","无货提醒","{}名下货柜名称为{}的货柜当前无货！！！请及时补货,谢谢！",Lists.newArrayList(UserType.PLATE.getCode()
            ,UserType.AGENT.getCode(),UserType.SITE.getCode(),UserType.STAFF.getCode())),
    LACK_CARGO(6,"缺货","缺货提醒","{}名下货柜名称为{}的货柜当前缺货！！！请及时补货,谢谢！",Lists.newArrayList(UserType.PLATE.getCode()
            ,UserType.AGENT.getCode(),UserType.SITE.getCode(),UserType.STAFF.getCode())),
    LOW_BATTLE(7,"低电","低电提醒","{}名下货柜名称为{}的货柜当前电量过低！！！,请及时更换电池,谢谢！",Lists.newArrayList(UserType.PLATE.getCode()
          ,UserType.AGENT.getCode(),UserType.SITE.getCode(),UserType.STAFF.getCode())),
    ;

    private Integer code;
    private String text;
    private String title;
    private String template;
    private List<String> readRangeTypes;

    NoticeTypes(Integer code, String text, String title, String template,List<String> readRangeTypes) {
        this.code = code;
        this.text = text;
        this.title = title;
        this.template = template;
        this.readRangeTypes = readRangeTypes;
    }

    public Integer getCode() {
        return code;
    }


    public String getText() {
        return text;
    }

    public String getTemplate() {
        return template;
    }

    public String getTitle() {
        return title;
    }

    public List<String> getReadRangeTypes() {
        return readRangeTypes;
    }

    public static String getTitle(Integer code) {
        NoticeTypes[] enums = NoticeTypes.values();
        for (NoticeTypes e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.title;
            }
        }
        return null;
    }

    public static List<String> getReadRangeTypes(Integer code) {
        NoticeTypes[] enums = NoticeTypes.values();
        for (NoticeTypes e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.readRangeTypes;
            }
        }
        return null;
    }

}